package com.example.designpattern.factory;

interface Mouse {
    void click();
}

class RazerMouse implements Mouse{

    @Override
    public void click() {
        System.out.println("点击雷蛇鼠标");
    }
}


class LogicMouse implements Mouse{

    @Override
    public void click() {
        System.out.println("点击罗技鼠标");
    }
}

public class SimpleMouseFactory{
    Mouse getMouse(String mouseName){
        if (mouseName.equalsIgnoreCase("Razer")){
            return new RazerMouse();
        }else if (mouseName.equalsIgnoreCase("Logic")){
            return new LogicMouse();
        }else {
            System.out.println("没有类物品");
            return null;
        }
    }
}

class Client{
    public static void main(String[] args) {
        SimpleMouseFactory mouseFactory=new SimpleMouseFactory();
        Mouse razer = mouseFactory.getMouse("razer");
        Mouse logic = mouseFactory.getMouse("Logic");
        razer.click();
        logic.click();
    }
}